#pragma once
#if !defined(__structs__)
#include "structs.h"
#define __structs__
#endif


typedef struct _SYSTEM_SERVICE_TABLE {
	LONG*   ServiceTableBase;
	PVOID   ServiceCounterTableBase;
	ULONGLONG   NumberOfServices;
	PCHAR   ParamTableBase;
} SYSTEM_SERVICE_TABLE, *PSYSTEM_SERVICE_TABLE;


VOID MyGetKeServiceDescriptorTable();

ULONGLONG GetSSDTFuncCurAddr(ULONG id);

ULONG GetSSDTFuncToId(char* Procname);

ULONGLONG GetSSDTFuncByName(char* Procname);

#pragma pack(push,1)
typedef struct _HOOKOPCODES
{
	unsigned short int mov;
	ULONG_PTR addr;
	unsigned char push;
	unsigned char ret;
}HOOKOPCODES;
#pragma pack(pop)

typedef struct _HOOKSTRUCT
{
	ULONG_PTR addr;
	HOOKOPCODES hook;
	unsigned char orig[sizeof(HOOKOPCODES)];
	//SSDT extension
	int SSDTindex;
	LONG SSDTold;
	LONG SSDTnew;
	ULONG_PTR SSDTaddress;
}HOOKSTRUCT,*HOOK;

HOOK HookSsdt(char* Procname, void* newfunc);

void UnHookSsdt(HOOK hHook);